﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.hud.components {
    import flash.display.*;
    import org.aswing.*;
    import Display.*;
    import Display.aswingui.*;
    import Display.hud.*;

    public class HUDComponent extends Sprite {

        public static const DEFAULT_MARGIN_TOP:int = 10;
        public static const DEFAULT_MARGIN_LEFT:int = 8;
        public static const DEFAULT_MARGIN_RIGHT:int = 8;

        protected var m_jWindow:JWindow;
        protected var m_jPanel:JPanel;
        protected var m_toolTip:ToolTip;
        protected var m_counter:HUDCounter;
        protected var m_counter1:HUDCounter;
        protected var m_counter2:HUDCounter;

        public function HUDComponent(){
            this.m_jWindow = new JWindow(this);
            this.buildComponent();
            this.showComponent();
        }
        public function initWithXML(_arg1:XML):void{
        }
        protected function showComponent():void{
            this.m_jWindow.setContentPane(this.m_jPanel);
            ASwingHelper.prepare(this.m_jWindow);
            this.m_jWindow.cacheAsBitmap = true;
            this.m_jWindow.show();
            this.alpha = 0;
            Z_TweenLite.to(this, 1, {alpha:1});
            this.attachToolTip();
            if (this.doubleBarComponent){
                this.setCounter1();
                this.setCounter2();
            } else {
                this.setCounter();
            };
        }
        protected function buildComponent():void{
        }
        public function doBuildComponent():void{
            this.buildComponent();
        }
        public function isVisible():Boolean{
            return (true);
        }
        public function reset():void{
        }
        public function get doubleBarComponent():Boolean{
            return (false);
        }
        public function cleanUp():void{
        }
        protected function attachToolTip():void{
        }
        public function refresh(_arg1:Boolean):void{
            if (this.m_counter){
                this.m_counter.update(_arg1);
            };
            if (this.m_counter1){
                this.m_counter1.update(_arg1);
            };
            if (this.m_counter2){
                this.m_counter2.update(_arg1);
            };
        }
        protected function setCounter():void{
        }
        protected function setCounter1():void{
        }
        protected function setCounter2():void{
        }
        public function updateCounter(... _args):void{
            if (this.m_counter.value != _args[0]){
                this.m_counter.value = _args[0];
            };
            this.refresh(false);
        }
        public function updateCounterCapacity(... _args):void{
            var _local2:HUDCapacityCounter;
            if ((this.m_counter is HUDCapacityCounter)){
                _local2 = (this.m_counter as HUDCapacityCounter);
                if (_local2.capacity != _args[0]){
                    _local2.capacity = _args[0];
                };
                this.refresh(false);
            };
        }
        public function updateCounter1(... _args):void{
            if (!this.doubleBarComponent){
                return;
            };
            if (this.m_counter1.value != _args[0]){
                this.m_counter1.value = _args[0];
            };
            this.refresh(false);
        }
        public function updateCounterCapacity1(... _args):void{
            var _local2:HUDCapacityCounter;
            if (!this.doubleBarComponent){
                return;
            };
            if ((this.m_counter1 is HUDCapacityCounter)){
                _local2 = (this.m_counter1 as HUDCapacityCounter);
                if (_local2.capacity != _args[0]){
                    _local2.capacity = _args[0];
                };
                this.refresh(false);
            };
        }
        public function updateCounter2(... _args):void{
            if (!this.doubleBarComponent){
                return;
            };
            if (this.m_counter2.value != _args[0]){
                this.m_counter2.value = _args[0];
            };
            this.refresh(false);
        }
        public function updateCounterCapacity2(... _args):void{
            var _local2:HUDCapacityCounter;
            if (!this.doubleBarComponent){
                return;
            };
            if ((this.m_counter2 is HUDCapacityCounter)){
                _local2 = (this.m_counter2 as HUDCapacityCounter);
                if (_local2.capacity != _args[0]){
                    _local2.capacity = _args[0];
                };
                this.refresh(false);
            };
        }

    }
}//package Display.hud.components 
